package servlet;

import pojo.Department;
import pojo.Doctor;
import service.DepartmentService;
import service.DepartmentServiceImpl;
import service.DoctorService;
import service.DoctorServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @author 陈金平
 * @Description
 * @create 2020/11/19 18:58
 */
public class GotoAddOneDoctor extends HttpServlet {
    private DepartmentService departmentService = new DepartmentServiceImpl();
    private DoctorService doctorService = new DoctorServiceImpl();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        List<Department> departments = departmentService.getAllDepartments();
        req.setAttribute("departments",departments);

        req.getRequestDispatcher("add_doctor.jsp").forward(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
       doGet(req, resp);
    }
}
